package com.candy.dao;

import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Set;

public class Test02 {
    public static void main(String[] args) {
        test01();
    }

    public static void test02() {
        int num=DBDriver4PS.update("INSERT INTO userinfo(username,userpwd,useraddress,usertel) VALUES(?,?,?,?);","敖光","123456","东海龙宫","14587968547");
        System.out.println(num);
    }


    public static void test01() {
//        LinkedList<LinkedHashMap<String,Object>> lp=DBDriver4PS.query4ListMap("select * from userinfo where username like ?","%张%");
        LinkedList<LinkedHashMap<String,Object>> lp=DBDriver4PS.query4ListMap("select * from userinfo;");
        //        对结果进行遍历
        for (LinkedHashMap<String,Object> map : lp){
//                取出该map中所有key放在set集合中
            Set se=map.keySet();
//                对set集合进行遍历，循环取出每个key对应的value
            for (Object key:se){
//              map.get(key)取出指定key所包含的value
                System.out.print(key+"："+map.get(key)+"\t");
            }
            System.out.println();
        }
    }
}
